;
var member_login_ops = {
    init: function () {
        this.eventBind();

    },
    eventBind: function () {
        $(".login_wrap .do_login").click(function () {
            var btn_target = $(this);
            if (btn_target.hasClass("disabled")) {
                $('.toast-body').text("正在处理，请不要重复点击");
                $('.toast').toast({delay: 2000});
                $('.toast').toast('show');
                return;
            } else {
                var login_name = $(".login_wrap input[name=login_name]").val();
                var login_pwd = $(".login_wrap input[name=login_pwd]").val();
                if (login_name == "" || login_name.length < 1) {
                    $("#LemailHelp").show();
                    $("#LemailHelp2").hide();
                } else if (login_pwd == "" || login_pwd.length < 6) {
                    $("#LemailHelp").hide();
                    $("#LemailHelp2").show();
                } else {
                    $("#LemailHelp").hide()
                    $("#LemailHelp2").hide()
                    btn_target.addClass("disabled");
                    $.ajax({
                        url: common_ops.buildUrl("/member/login"),
                        type: "POST",
                        data: {
                            login_name: login_name,
                            login_pwd: login_pwd
                        },
                        dataType: "json",
                        success: function (login) {
                            btn_target.removeClass("disabled");
                            $('.toast-body').text(login.msg);
                            $('.toast').toast({delay: 2000});
                            $('.toast').toast('show');
                            if (login.code == 200) {
                                window.location.href = "/";
                            }
                        }
                    });
                }
            }

        });
    }
}

$(document).ready(function () {
    $("#LemailHelp").hide()
    $("#LemailHelp2").hide()
    member_login_ops.init()

});